#pragma once

#include <string>

namespace xs
{

struct Character
{
	int x, y;
	int width, height;
	int xoffset, yoffset;
	int xadvance;
	int page;
};

union Kerning
{
	struct
	{
		u16 first;
		u16 second;
	};
	u32		id;
};


class FontImpl: public Font
{
public:
									FontImpl(const wchar_t *name, Renderer *xse);
									~FontImpl();

	virtual void					print(const int &x, const int &y, const wchar_t *text, const Color &color);
	virtual void					print_ex(const int &x, const int &y, const wchar_t *text,const Color &color, const int &line_width);
	virtual u32						get_width(const wchar_t *text);
	virtual u32						get_line_height();
private:
	Renderer*						xse;
	int								line_height;
	std::map<int, Texture>			pages;
	std::map<wchar_t, Character>	chars;
	std::map<u32, u32>				kernings;
};

}